1. Field of the Invention
The present invention relates to a motor control apparatus and a motor control method for controlling driving of a motor.
2. Description of the Related Art
Motors are widely used for controlling paper conveyance of printer apparatuses and printing apparatuses, controlling head positions of disk storage devices, and the like. These apparatuses control driving of the motor so as to drive the motor at a predetermined speed or perform positional control by moving a target to a desired position. As a method of controlling the driving of the motor, known is a technique in which a positional sensor and/or a speed sensor are provided on a motor shaft or a movement target and a current position and/or a current speed are compared with a target position and/or a target speed by using output signals from these sensors, and thus a motor driving amount is feedback-controlled.
A technique of executing the feedback control of the motor by digital control is widely used. For example, the driving of the motor is controlled by performing sampling of a sensor signal regularly to perform a control processing operation and output the driving amount of the motor by using a microcomputer that includes a central processing unit (CPU), a memory, and an input/output port. The processing of controlling the driving of the motor includes requesting an interrupt to the CPU at a predetermined sampling cycle by using an interrupt mechanism that is included in the microcomputer generally and performing the control processing operation in the interrupt processing, in general.
Japanese Patent Application Laid-open No. 2006-338367 discloses a technique of performing driving control of the motor by using a timer interrupt relating to digital control of the motor driving by the interrupt processing. That is to say, in Japanese Patent Application Laid-open No. 2006-338367, the driving processing of the motor is executed in accordance with a timer interrupt signal that is generated at the predetermined interval. Then, when delay is generated due to execution of processing corresponding to another interrupt signal, a delay time until the driving processing is executed from the generation of the interrupt signal is calculated. Subsequently, corrected position information is calculated from the delay time so as to update position information, and feedback control is performed. The technique as disclosed in Japanese Patent Application Laid-open No. 2006-338367 can suppress lowering of accuracy of the control when the interrupt processing is delayed.
Furthermore, Japanese Patent Application Laid-open No. 2011-44006 discloses a technique of grasping a current rotating position of a motor by using a two-phase counter and a one-phase counter. The two-phase counter detects respective two-phase pulse signals that are output from encoders so as to perform counting processing. The one-phase counter detects an A-phase pulse signal only so as to perform counting processing. That is to say, in Japanese Patent Application Laid-open No. 2011-44006, a target speed based on positional error as a difference between a target position and the current position grasped by the two-phase counter and the one-phase counter is output. In addition, the magnitude of the positional error is determined. When the magnitude of the positional error is a relatively small value, the two-phase counter is used to obtain the current position. On the other hand, when the magnitude of the positional error is a relatively large value, the one-phase counter is used to obtain the current position. The technique as disclosed in Japanese Patent Application Laid-open No. 2011-44006 enables the current rotating position of the motor to be grasped without using a counter having high performance or an application specific integrated circuit (ASIC) alternative to the counter.
In the digital control, there is a problem in that when another interrupt processing has a priority, a control operation is delayed and control accuracy is lowered. In order to solve the problem, in Japanese Patent Application Laid-open No. 2006-338367, the delay time is measured to correct the control processing. This suppresses deterioration of the control accuracy due to another interrupt processing. Even when the technique as disclosed in Japanese Patent Application Laid-open No. 2006-338367 is used, there is a risk that lowering of some accuracy occurs due to another interrupt processing.
Furthermore, in Japanese Patent Application Laid-open No. 2006-338367, the control operation processing from the sampling to the output of the driving amount is delayed and this leads to the occurrence of phase delay of a control amount. The phase delay of the control amount reduces a phase margin, resulting in impairing of control stability in some cases. This causes a possibility that an unstable state such as oscillation is caused.
On the other hand, in the feedback control of the rotating position or the rotating speed of the motor by using the microcomputer as disclosed in Japanese Patent Application Laid-open No. 2011-44006, delay of the control processing due to another interrupt processing does not occur because another interrupt processing is not received.
Also in Japanese Patent Application Laid-open No. 2011-44006, if the number of pieces of processing to be executed in the interrupt processing is larger, there is a possibility that the pieces of processing are not finished within a predetermined cycle of the interrupt processing. When the pieces of processing are not finished within the predetermined cycle of the interrupt processing, there is a risk that a normal operation cannot be performed and the control fails. The problem also occurs in Japanese Patent Application Laid-open No. 2006-338367.
When the cycle of the control interrupt is made shorter, control performance can be improved. In addition, when the cycle of the control interrupt is made shorter, the count processing can be performed by software of the interrupt processing without using expensive hardware such as a counter. When the interrupt cycle is made shorter, the possibility that the pieces of processing are not finished within the interrupt cycle is further increased. Although this problem can be solved by using the CPU capable of achieving high-speed processing, there has been a problem in that the cost for the CPU main body and peripheral structures of the CPU is increased in this case.
In view of the above-mentioned circumstances, there is a need to perform driving control of a motor with high accuracy without using expensive hardware.